<?php
namespace App\Utility;

use EasySwoole\RabbitMq\MqQueue;
use EasySwoole\RabbitMq\MqJob;

class MqComposer{

    public static function push(){
        $job = new MqJob();
        $job->setJobData('order.'.rand(1000,9999));
        $job->setRoutingKey('order');
        $res = MqQueue::getInstance()->producer()->setConfig('test_topic_ex', 'com.a', 'topic', '')->push($job);
        if($res){
            var_dump('发布成功');
        }else{
            var_dump('发布失败');
        }
    }
}